package org.ruwang.javaailangchain4j.config;

import dev.langchain4j.memory.chat.ChatMemoryProvider;
import dev.langchain4j.memory.chat.MessageWindowChatMemory;
import org.ruwang.javaailangchain4j.store.PersistentChatMemoryStore;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class SeparateChatAssistantConfig {

    @Autowired
    private PersistentChatMemoryStore PersistentChatMemoryStore;
    @Bean
    public ChatMemoryProvider chatMemoryProvider(){
        return memoryId ->
                MessageWindowChatMemory
                        .builder()
                        .id(memoryId)
                        .maxMessages(10)
                        //.chatMemoryStore(PersistentChatMemoryStore) 配置持久化对象
                        .build();
    }
}
